<script setup lang="ts">
import VDialog from "/@/utils/dialogUtil.ts";
const attrs = useAttrs()
const props = defineProps({
  modelValue:{

  },
  petTypeId: {

  },
  label: {

  }
})
const emits= defineEmits(['update:modelValue'])
const selected = ref(null)
const storeName = ref(null)
const handInputChange=()=> {
  emits('update:modelValue',selected.value)
}
watch(()=>props.petTypeId,(val)=> {
  if (val) {
    initData()
  }
})
watch(()=>props.label,()=> {

  storeName.value = props.label
})
const treeData = ref(null)
onMounted(async () => {
  await initData()
})

const initData =async () => {

}
const chooseStore =()=> {

  VDialog.open({
    title: '选择',
    config: {
      chooseMode: true,
      single: true
    },
    content: { //内容初始形式
      type: 'component', //text:"",预留文本
      name: '/storeInfoService/pageData',
      query: {}
    },

    callBack: (data: any) => {
      console.log(data);
      let store = data[0]
      storeName.value = store.storeName
      selected.value = store.id

      emits('update:modelValue',selected.value)
    },
    onClose: () => {
      console.log("对话框已关闭");
    },
  });
}
</script>

<template>
  <div class="container">
    <el-input disabled v-model="storeName"></el-input>
    <el-button @click="chooseStore" type="primary" class="ml-1">选择店铺</el-button>
  </div>
</template>

<style scoped lang="scss">
.container {
  width: 100%;
  display: flex;
}
</style>
